<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let data = {
            name: 'aaa',
            age: 12
        }
        sessionStorage.setItem('data', data)

        // 使用上跟localStroage一样，调用的方法名都一模一样
        // 区别点就是时效 --  关闭浏览器sessionStorage会自动清空数据，而localStroage不会
    </script>
</body>

</html>